import saleOutDepot from "../../api/sale-out-depot";
let brand = {
    data(){
        return{
            tableData: [],//数据信息
            total: '',//总条数
            searchParams: {
                currentPage: 1,//当前页
                pageSize: 5,//每页显示条数
                id:'',
                indentType: '',
                payType:'',
                vipNumber:'',
                sodStatus:'',
                startTime:'',
                endTime:''
            },
            formData: {
            },//新增表单信息
            types:[{value:'电话订单'},{value:'网络订单'},{value:'淘宝网店'},{value:'当当网店'}],
            payTypes:[{value:'货到付款'},{value:'款到发货'}],
            sodState:[{value:'全部',key:undefined},{value:'待出库',key:'0'},{value:'已出库',key:'1'}],
            searchTimes:[],
        }
    },
    methods:{
        /**
         * 查询所有
         */
        async searchPage() {
            console.log(this.searchParams);
            let response = await saleOutDepot.findPage(this.searchParams);
            console.log("resp:");
            console.log(response);
            this.total = response.total;//总行数赋值
            this.tableData = response.data;//数据信息赋值
        },
        /**
         * 同步搜索条件 时间
         */
        paramsTimeChange(){
            this.searchParams.startTime = this.searchTimes[0];
            this.searchParams.endTime = this.searchTimes[1];
        },

        currentPageChange(page){
            // alert(this.searchParams.currentPage+";"+page);
            this.searchParams.currentPage = page;
            this.searchPage();
        },

        resetForm(){
            this.$refs.searchForm.resetFields();
            this.searchTimes = undefined;
            this.searchParams.startTime = undefined;
            this.searchParams.endTime = undefined;
        }
    },
    created(){
        this.searchPage();
    }
};

export default brand;